<template>
  <div class="app-container">
    <el-tabs v-model="activeName">
      <el-tab-pane v-for="item in iconList" :key="item.label" :label="item.label" :name="item.label">
        <div>共计<span class="color-primary" style="font-size:14px;margin:0 5px">{{ item.list.length }}</span>个图标</div>
        <div class="icon-list-container">
          <div v-for="icon in item.list" :key="icon.value" class="icon-item">
            <template v-if="item.type==='svg'">
              <svg-icon :icon-class="icon.value" style="font-size:36px" class="icon" />
            </template>
            <template v-if="item.type==='iconfont'">
              <span class="icon iconfont" :class="icon.value" />
            </template>
            <el-tooltip class="item" effect="dark" :content="icon.label+'（'+icon.value+'）'" placement="bottom">
              <div class="name"> {{ icon.label }}</div>
              <div class="code-name">.{{ icon.value }} </div>
            </el-tooltip>
          </div>

        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeName: '',
      iconList: this.iconList
    }
  },
  created() {
    if (this.iconList.length > 0) {
      this.activeName = this.iconList[0].label
    }
  }
}
</script>
<style lang="scss" scoped>
    .app-container{
        background-color: #fff;
        padding: 10px;
    }
    .icon-list-container{
        display: flex;
        flex-wrap: wrap;
        .icon-item{
            text-align: center;
            width: 100px;
            padding: 15px 20px 0;
            -webkit-transition: all .2s;
            transition: all .2s;
        }
        .icon{
            font-size: 24px;
        }
        .name,.code-name{
            color: #666;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12px;
        }
    }
</style>

